import React, { Component } from 'react';
import styles from './index.less';
import { Icon } from 'antd';
import { connect } from 'react-redux';
import { actionTypes } from './store';
import { AuthorItem } from './authorItem'
class AuthorWrapper extends Component {
  constructor(props){
    super(props)
  };
  render(){
    return (
      <div className={ styles.AuthorWrapper}> 
        <div className={`${styles.AuthorTitle} ${ styles.clearfix }`}>
          <span> 推荐作者</span>
          <a><Icon type="sync" spin />换一批</a>
        </div>
        <div className={styles.AuthorList}>
          {/* {this.AuthorItem} */}
          <AuthorItem  value={this.props.author} />
        </div>
      </div>
    ); 
  };
  componentDidMount(){
    return this.props.getAuthor()
  }
};
const mapState = (state) => { 
  return{
    author:state.home.authorList,
  }
};
const mapDispatchToProps =(dispatch) =>{
  return{
    getAuthor(){
      dispatch(actionTypes.gitAuthors())
    }
  }
};
export default connect(mapState,mapDispatchToProps)(AuthorWrapper);